<?php
class Entries_model extends CI_Model{

	function getAllEntris(){
		//$data=$this->db->get('entries');
		$data=$this->db->query('select * from entries');
		return $data;
	}

	function delEntris($id){
		$this->db->where('id',$id);
		$data=$this->db->delete('entries');
		return $data;
	}

	function getEntris($id){
		$this->db->where('id',$id);
		$data=$this->db->get('entries');
		return $data;
	}

	function  addEntries(){
		$data=array(
				'title'=>$_POST['title'],
				'body'=>$_POST['body'], 
		);
		$this->db->insert('entries',$data);
		return $this->db->insert_id();
	}

	function  updateEntries($id,$data){
		$this->db->where('id',$id);
		$this->db->update('entries',$data);
	}
}
?>